var mysql = require("mysql");
var pool = mysql.createPool({
  connectionLimit: 10,
  host: "localhost",
  user: "root",
  password: "root",
  database: "mydatabase",
});

function query(sql) {
  return new Promise((resolve, reject) => {
    pool.query(sql, function (error, results) {
      if (error) {
        reject(error);
      }
      resolve(results);
    });
  });
}

module.exports = { query };
